<?php

Route::group(['domain' => str_replace('http://', '', config('app.url')),'namespace' => 'Home'], function () {
    Route::get('/', 'IndexController@index');
    Route::any('/wechat', 'WeChatController@serve');//微信接收口
});


Route::group(['domain' => str_replace('http://', '', config('app.admin_url')),'namespace' => 'Admin'], function () {
    Route::get('/login', 'AuthController@login');
    Route::post('/login','AuthController@postLogin');
    Route::group(['middleware' => 'auth'], function () {
        Route::get('/', 'IndexController@index');
        //系统设置
        Route::get('/system', 'SystemController@index');
        Route::post('/system/close', 'SystemController@postClose');
        //微信菜单
        Route::get('/wx/menu/edit', 'WxController@menuEdit');
        Route::post('/wx/menu/edit', 'WxController@postMenuEdit');
        //首页幻灯片
        Route::get('/carouse', 'CarouseController@index');
        Route::get('/carouse/add', 'CarouseController@add');
        Route::get('/carouse/edit/{id}', 'CarouseController@edit')->where(['id' => '[0-9]+']);
        Route::post('/carouse/edit', 'CarouseController@postEdit');
        Route::get('/carouse/delete/{id}', 'CarouseController@delete')->where(['id' => '[0-9]+']);
        //商品分类
        Route::get('/category', 'CategoryController@index');
        Route::get('/category/add', 'CategoryController@add');
        Route::get('/category/edit/{id}', 'CategoryController@edit')->where(['id' => '[0-9]+']);
        Route::post('/category/edit', 'CategoryController@postEdit');
        Route::get('/category/delete/{id}', 'CategoryController@delete')->where(['id' => '[0-9]+']);
        //商品分类
        Route::get('/goods', 'GoodsController@index');
        Route::get('/goods/add', 'GoodsController@add');
        Route::get('/goods/edit/{id}', 'GoodsController@edit')->where(['id' => '[0-9]+']);
        Route::post('/goods/edit', 'GoodsController@postEdit');
        Route::get('/goods/delete/{id}', 'GoodsController@delete')->where(['id' => '[0-9]+']);
        Route::get('/goods/update/status/{id}','GoodsController@updateStatus')->where(['id' => '[0-9]+']);
        //用户
        Route::get('/user', 'UserController@index');
        Route::get('/user/address', 'UserController@address');
        //订单
        Route::get('/order', 'OrderController@index');
        Route::get('/order/detail', 'OrderController@detail');

    });
});
